package com.my.cd.template;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 热饮模板实现类：泡茶
 */
public class Tea extends HotDrink {
    @Override
    public void brew() {
        System.out.println("brewing the tea");
    }

    @Override
    public void addCondiments() {
        System.out.println("adding lemon");
    }

    /**
     * 泡茶的时候询问用户，是否放调料
     *
     * @return
     */
    @Override
    protected boolean wantCondimentsHook() {
        System.out.println("Condiments,yes or no? please input(y/n):");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String result = "";
        try {
            result = in.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return result.equals("y");
    }
}
